<?php

// Include
include_once('include/header.php');
include_once('plugin/EmpresaDBPlugin.php');


// Breadcrumb
$breadcrumb = AppConfigPlugin::getBreadcrumb(basename($_SERVER['PHP_SELF']));
$smarty->assign('breadcrumb', $breadcrumb);


// Procesar el formulario
if (isset($_POST[sendform])) {
	if (isset($_POST[action]) && ($_POST[action] == "save")) {
		$message = EmpresaDBPlugin::saveContactos($_POST[direccion], $_POST[telefono], $_POST[telefonocelular], $_POST[mail]);
		CommonPlugin::setMessage($message);
	}
	header( 'Location: datoscontacto.php' );
	exit;	
} else {
	$contactos = EmpresaDBPlugin::getContactos();
}


// Smarty call
$smarty->assign('contactos', $contactos);

$smarty->display('editdatoscontacto.tpl');

?>